<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>03JS数据类型</title>
</head>
<body>
<script>
   //JS数据类型 = 原始类型 + 引用类型
   //原始类型: number,string,boolean,null,undefined
   var a = 1;
   var b = 6.6;
   console.log(a,typeof a);
   console.log(b,typeof b);
   var c = '123';
   var d = "123"
   console.log(c,typeof c);
   console.log(d,typeof d);
   var e = true;
   var f = false;
   console.log(e,typeof e);
   console.log(f,typeof f);
   //声明了变量,但未赋值,会得到undefined
   var g;
   console.log(g,typeof g);

   //引用类型 : object,array,function,number
   //1)自定义JS对象
   let obj = {
       //属性名:属性值,多对值使用逗号隔开
       name:'黄霄雲',
       age:18,
       sex:'女'
    }
   console.log(obj,typeof obj);
   console.log(obj.name,obj.age,obj.sex);

   obj.age = 19;
   console.log(obj.name,obj.age,obj.sex);
   obj.like = '唱歌';//like属性不存在,则为动态增加一个属性
   console.log(obj);

   console.log(obj.play);// play属性不存在,为undefined

   //2)JS数组
   let arr = ['黄霄雲','孙雪宁','李庚希',18,18,18,false];
   console.log(arr,typeof arr);
   console.log(arr[0],arr[1],arr[2],arr[3],arr[4],arr[5],arr[6]);
   console.log(arr[899]);//索引越界,为undefined



</script>
</body>
</html>